**** This file is the main code of the replication 


**** Install necessary packages

ssc install egenmore
ssc install geonear
ssc install geodist
ssc install winsor2

*** Set path

global path "\\intra\partages\UA1376_Publi\PumpPrices\Codes\Replication_JPEMacro\"


****** PART A: DIESEL *****
****** Part A.1. Create Intermediary Data for diesel

clear
do "$path\Codes\Prepare_IntermediaryData\Diesel\01_Clean_DataGazole.do"
clear
do "$path\Codes\Prepare_IntermediaryData\03_Clean_Data_BrentRotterdamUSD.do"
clear
do "$path\Codes\Prepare_IntermediaryData\04_Clean_InfoPDV2.do"
clear
do "$path\Codes\Prepare_IntermediaryData\Diesel\05_Prepare_DataRegressions_AllCarburants.do"
clear
do "$path\Codes\Prepare_IntermediaryData\Diesel\06_Prepare_localshocks_markups.do"
clear
do "$path\Codes\Prepare_IntermediaryData\Diesel\07_Create_Data_for_estimation_new_accelerate"
clear
do "$path\Codes\Prepare_IntermediaryData\Diesel\08_CIR_calculations.do"
clear
do "$path\Codes\Prepare_IntermediaryData\Diesel\09_kur_freq.do"
clear
do "$path\Codes\Prepare_IntermediaryData\Diesel\10_create_id_suff_stat.do"
clear
do "$path\Codes\Prepare_IntermediaryData\Diesel\11_create_p_minus_pstar.do"
clear



******* Part A.2. Run regressions and exports figures and tables for diesel

*** FIGURES

*** Main
do "$path\Code_for_GraphsTables\Main\Figure1_FigureA6.do"
clear
do "$path\Code_for_GraphsTables\Main\Figure2.do"
clear
do "$path\Code_for_GraphsTables\Main\Figure3_A4.do"
clear
do "$path\Code_for_GraphsTables\Main\Figure4.do"
clear
do "$path\Code_for_GraphsTables\Main\Figure5and6.do"
clear
do "$path\Code_for_GraphsTables\Main\Figure7a.do"
clear
do "$path\Code_for_GraphsTables\Main\Figure7b.do"
clear

*** Appendix
do "$path\Code_for_GraphsTables\OnlineAppendix\Figure_A1_A2_Appendix.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\FigureA3_TablesA2_A3_A4.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\FigureA5.do"
clear

do "$path\Code_for_GraphsTables\OnlineAppendix\Figure_B1.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\Figure_B2.do"
clear

do "$path\Code_for_GraphsTables\OnlineAppendix\Figure_C1.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\Figure_C2.do"
clear


*** TABLES

*** Main
do "$path\Code_for_GraphsTables\Main\Table1.do"
clear
do "$path\Code_for_GraphsTables\Main\Table2.do"
clear
do "$path\Code_for_GraphsTables\Main\Table3.do"
clear
do "$path\Code_for_GraphsTables\Main\Table4.do"
clear
do "$path\Code_for_GraphsTables\Main\Table5.do"
clear


*** Appendix
do "$path\Code_for_GraphsTables\OnlineAppendix\TableA1.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\TableA5.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\TableA6.do"
clear

do "$path\Code_for_GraphsTables\OnlineAppendix\TableD1.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\TableD2.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\TableD3.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\TableD4.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\TableD5.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\TableD6.do"
clear



**** Part B. SP95 ****

****** Part B.1. Create Intermediary Data for SP95

do "$path\Codes\Prepare_IntermediaryData\SP95\01_Clean_DataSP95.do"
clear
do "$path\Codes\Prepare_IntermediaryData\SP95\05_Prepare_DataRegressions_SP95.do"
clear
do "$path\Codes\Prepare_IntermediaryData\SP95\06_Prepare_localshocks_markups_sp95.do"
clear
do "$path\Codes\Prepare_IntermediaryData\SP95\07_Create_Data_for_estimation_sp95.do"
clear
do "$path\Codes\Prepare_IntermediaryData\SP95\08_CIR_calculations_sp95.do.do"
clear
do "$path\Codes\Prepare_IntermediaryData\SP95\09_kur_freq_sp95.do"
clear
do "$path\Codes\Prepare_IntermediaryData\SP95\10_create_id_suff_stat_sp95.do.do" 
clear

*** Part B.2. Run regressions and export tables

*** Appendix
do "$path\Code_for_GraphsTables\OnlineAppendix\TableE1 - SP95.do"
clear
do "$path\Code_for_GraphsTables\OnlineAppendix\TableE2 - SP95.do"
clear
